# 4.1
a = 123
# 身份
print(id(a))
# 类型
print(type(a))
# 值

# 4.2
# 标准类型
# Integer
# Boolean
# Long integer 去掉了
# float
# complex number
# string
# list
# Tuple
# dictionary

# 4.3
# NoneType
none = None
print(none)
print(not None, not False, not 0, not 0.0, not 0.0 + 0.0j, not '', not [], not (), not {})

# 4.4
# 内部类型 代码 帧 跟踪记录 切片 省略 Xrange
foostr = 'abcde'
print(foostr[::-1])
print(foostr[::-2])
foolist = [123, 'xba', 342.23, 'abc']
print(foolist[::-1])
print('0123456789abcdef'[0:12:1])
print(...)
print(type(...))
print(bool(...))
print([1, 2, ..., 9])
# pass
try:
    1 / 0
except ZeroDivisionError:
    ...
# python 3 range is xrange
print([x ** 2 for x in range(10) if x % 2])

# 4.5
print(4 < 5 < 6 < 7, 'abc' < 'abd', [2, 'abc'] == [2, 'abc'])
foo1 = foo2 = 4.3
print(id(foo1), id(foo2))

foo2 = foo1
print(id(foo1), id(foo2))
foo1 = 4.3
foo2 = 1.2 + 3.1
print(id(foo1), id(foo2), foo1 == foo2, foo1 is foo2)
print(foo1 is not foo2)
sum = 0
for i in range(10):
    sum += 0.1
    print(sum)
print(0.2 + 0.1)
# https://docs.python.org/2/tutorial/floatingpoint.html
